package d02_thread_create;

public class Test2Runable {
    public static void main(String[] args) {
        //需求：同时播放音乐，同时下载资料，同时浏览网页

        //3.创建一个任务对象
        MyRunnable runnable = new MyRunnable();

        //4.把任务对象交给Thread处理
        Thread thread = new Thread(runnable);
        thread.start();

        //5.启动线程
        for (int i = 0; i < 10; i++) {
            System.out.println("主线程：" + i);
        }

        //6.创建一个新线程，并用Lambda表达式创建一个Runnable接口的实现类对象
        Thread thread2 = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println("浏览网页···" + i);
            }

        });
    }
}
